#pragma once

#include<iostream>
#include<string>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>

//封装对于结构体的拷贝赋值

class CopySocket{
    public:
    CopySocket(struct sockaddr_in &addr):_addr(addr)
    {
        _ip=inet_ntoa(_addr.sin_addr);
        _pd=ntohs(_addr.sin_port);
    }

    std::string Get_ip()
    {
        return _ip;
    }

    uint16_t Get_port()
    {
        return _pd;
    }
    std::string PrintDebug()
    {
        std::string info;
        info+=_ip;
        info+=":";
        info+=std::to_string(_pd);
        return info;
    }
    ~CopySocket()
    {

    }
    private:
    struct sockaddr_in _addr;
    std::string _ip;
    uint16_t _pd;

};